package application.caiji;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.junit.Test;

import com.alibaba.fastjson.JSONArray;

public class test {
	public static void main(String[] args) throws SQLException {
		System.out.println("开始" + new Date());
//		
//		String sql="update extension_pt_promotion_analysis set quality_marker_all=0," +
//                " quality_marker_notset =0, " +
//                " quality_marker_conform = 0, " +
//                " quality_marker_72notcall = 0, " +
//                " quality_marker_errocall = 0, " +
//                " quality_marker_agenotonform = 0, " +
//                " quality_marker_educationnotonform = 0, " +
//                " quality_marker_hangupcall = 0, " +
//                " quality_marker_nointerest = 0," +
//                " quality_marker_noJudage = 0," +
//                " abandoning_sales = 0," +
//                " continue_sales = 0," +
//                " else_sales = 0, " +
//                " continue_sales_compliance = 0," +
//                " quality_marker_nomajor = 0"
//                +" where pt>=20220301 and extensionsourceid in(8,9) ";
//		System.out.println(sql);
//		new Thread(new Runnable() {
//			
//			@Override
//			public void run() {
//				System.out.println("线程内执行..");
//				throw new RuntimeException("抛出异常..");
//			}
//		}).start();
//		String sql="SELECT ocid,submit_flag_new,lingquyeji_flag,tuiguangTime_flag FROM userorder_analysis_temp WHERE ocid=23331 limit 1";
//		RowSet executeQuery = mySqlHelper_pool.executeQuery(mySqlHelper_pool.Conn_thuiguang, sql,null);
//		while (executeQuery.next()) {
//			System.out.println(executeQuery.getString("submit_flag_new"));
//			System.out.println(executeQuery.getString("lingquyeji_flag"));
//			System.out.println(executeQuery.getString("tuiguangTime_flag"));
//		}
//		String big="50";
//		System.out.println(new BigDecimal(big).divide(new BigDecimal("3")).multiply(new BigDecimal("3")));
//		Date datetime=new Date();
//		SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//		System.out.println(dateFormat.format(datetime));
//		dateFormat.setLenient(false);
		
		try {
			gettestexception();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			StringWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			e.printStackTrace(pw);
			String msg = sw.toString();
			if(msg.length()>1000) {
				System.out.println(msg.substring(0,1000));
			}else {
				System.out.println(msg.substring(0,msg.length()));
			}
		}
		
		System.out.println("结束" + new Date());
	}
	/*
	 * 异常分析
	 */
	private static void gettestexception() throws ParseException {
		System.out.println("执行代码");
		int x=2;
		String string="2022-11-01 01:01:xx";
		if(x==1) {
			throw new RuntimeException("运行时异常");
		}else if(x==2) {
			throw new ParseException("格式异常x", 0);
		}
		SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		format.setLenient(false);
		format.parse(string);
		System.out.println(string.length());
	}
	
	public String toHex(String arg) {
	    return String.format("%040x", new BigInteger(1, arg.getBytes(/*YOUR_CHARSET?*/)));
	}
	public static String getUTF8StringFromGBKString(String gbkStr) {  
        try {  
            return new String(getUTF8BytesFromGBKString(gbkStr), "UTF-8");  
        } catch (UnsupportedEncodingException e) {  
            throw new InternalError();  
        }  
    }  
      
    public static byte[] getUTF8BytesFromGBKString(String gbkStr) {  
        int n = gbkStr.length();  
        byte[] utfBytes = new byte[3 * n];  
        int k = 0;  
        for (int i = 0; i < n; i++) {  
            int m = gbkStr.charAt(i);  
            if (m < 128 && m >= 0) {  
                utfBytes[k++] = (byte) m;  
                continue;  
            }  
            utfBytes[k++] = (byte) (0xe0 | (m >> 12));  
            utfBytes[k++] = (byte) (0x80 | ((m >> 6) & 0x3f));  
            utfBytes[k++] = (byte) (0x80 | (m & 0x3f));  
        }  
        if (k < utfBytes.length) {  
            byte[] tmp = new byte[k];  
            System.arraycopy(utfBytes, 0, tmp, 0, k);  
            return tmp;  
        }  
        return utfBytes;  
    }

	public static String change(String str) {
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < str.length(); i++) {
			// 如果是小写
			if (str.substring(i, i + 1).equals(str.substring(i, i + 1).toLowerCase())) {
				sb.append(str, i, i + 1);
			} else {
				sb.append(str.substring(i, i + 1).toLowerCase());
			}
		}
		return sb.toString();
	}

	@Test
	public void test2() throws ParseException, CloneNotSupportedException {
		// TODO test
//		getuserid();
//		getColumnList();
//		getColumnArrayStr();
	}
	/**
	 * 生成字符数组字符串
	 */
	private void getColumnArrayStr() {
		String result="";
		String str="pt,timeinterval,extensionsourceid,masterid,matchedPattern,keyWord,keywordCode,clienttype,paymoney,avg_clickmoney,clicknumber,viewnumber,clickrate,importer,discount_searchpaymoney,reg_user_number,buy_user_number,order_price,order_number,campaignName,groupName,extensionsourcetype,discount_paymoney,project_team";
		String[] split = str.split(",");
		for (int i = 0; i < split.length; i++) {
			result+="\""+split[i]+"\",";
			if((i+1)%5==0) {
				result+="\r\n";
			}
		}
		if(result.length()>0) {
			result=result.substring(0, result.length()-1);
		}
		System.out.println(result);	
	}
	//	@Test
	public void addding() {
		String str = "3587010,6626112,6950977,7367947,7388066,7768347,7794361,7945289,8392899,13376652,13411354,13426466,13436376,13486219,13489269,13501660,13507882,13547935,13591080,13618894,13659848,13666289,13666408,13667163,13669697,13671878,13677320,13690367,13702471,13715376,13720753,13734420,13738429,13749238,13768673,13777673,13784506,13789185,13792360,13793404,13805567,13811304,13833986,13844398,13850016,13859155,13879654,13888018,13899586,13900826,13934902,13936022,13936902,13945610,13946631,13947536,13948346,13948693,13951448,13956424,13959930,13965109,13971066,13980819,14027824,14042369,14045810,14063308,14076376,14079383,14084623,14090716";
		String[] split = str.split(",");
		System.out.println(split.length);
	}

	// 找出两组json数据中不同的数据
	public void jsondateValidation() {
		Map<String, String> map1 = new HashMap<>();
		JSONArray jsonArray1 = JSONArray.parseArray(
				"[{\"Id\":\"913929\"},{\"Id\":\"1283250\"},{\"Id\":\"1283251\"},{\"Id\":\"1283252\"},{\"Id\":\"1283253\"},{\"Id\":\"1351158\"},{\"Id\":\"1351170\"},{\"Id\":\"1351188\"},{\"Id\":\"1351189\"},{\"Id\":\"1351190\"},{\"Id\":\"1351191\"},{\"Id\":\"1351192\"},{\"Id\":\"1351201\"},{\"Id\":\"1351203\"},{\"Id\":\"1504173\"},{\"Id\":\"1609235\"},{\"Id\":\"1609383\"},{\"Id\":\"1609384\"},{\"Id\":\"1609385\"},{\"Id\":\"1609386\"},{\"Id\":\"1609387\"},{\"Id\":\"1609388\"},{\"Id\":\"1609390\"},{\"Id\":\"1609391\"},{\"Id\":\"1609400\"},{\"Id\":\"1609402\"},{\"Id\":\"1609403\"},{\"Id\":\"1609404\"},{\"Id\":\"1609405\"},{\"Id\":\"1609406\"},{\"Id\":\"1610747\"},{\"Id\":\"1610749\"},{\"Id\":\"1610758\"},{\"Id\":\"1610760\"},{\"Id\":\"1614839\"},{\"Id\":\"913954\"},{\"Id\":\"1161806\"},{\"Id\":\"1283222\"},{\"Id\":\"1283245\"},{\"Id\":\"1283248\"},{\"Id\":\"1283249\"},{\"Id\":\"1283257\"},{\"Id\":\"1351193\"},{\"Id\":\"1609229\"},{\"Id\":\"1609249\"},{\"Id\":\"1609250\"},{\"Id\":\"1609382\"},{\"Id\":\"1609389\"},{\"Id\":\"1609392\"},{\"Id\":\"1609393\"},{\"Id\":\"1609394\"},{\"Id\":\"1609395\"},{\"Id\":\"1609396\"},{\"Id\":\"1609397\"},{\"Id\":\"1609398\"},{\"Id\":\"1609399\"},{\"Id\":\"1609401\"},{\"Id\":\"1609407\"},{\"Id\":\"1609408\"},{\"Id\":\"1609409\"},{\"Id\":\"1609410\"},{\"Id\":\"1609411\"},{\"Id\":\"1609412\"},{\"Id\":\"1609413\"},{\"Id\":\"1609414\"},{\"Id\":\"1610821\"},{\"Id\":\"1610823\"},{\"Id\":\"1610825\"},{\"Id\":\"1610828\"},{\"Id\":\"1614844\"},{\"Id\":\"1610275\"},{\"Id\":\"1610276\"},{\"Id\":\"1610277\"},{\"Id\":\"1610278\"},{\"Id\":\"1610279\"},{\"Id\":\"1610280\"},{\"Id\":\"1614449\"},{\"Id\":\"1614450\"},{\"Id\":\"1614451\"},{\"Id\":\"1614452\"},{\"Id\":\"1614453\"},{\"Id\":\"1614454\"},{\"Id\":\"1614455\"},{\"Id\":\"1614456\"},{\"Id\":\"1614457\"},{\"Id\":\"1614458\"},{\"Id\":\"1614459\"},{\"Id\":\"1614840\"},{\"Id\":\"1614841\"},{\"Id\":\"1614842\"},{\"Id\":\"1614843\"},{\"Id\":\"1620905\"},{\"Id\":\"1620906\"},{\"Id\":\"1620907\"},{\"Id\":\"1620908\"},{\"Id\":\"1620909\"}]");
		for (int i = 0; i < jsonArray1.size(); i++) {
			map1.put(jsonArray1.getJSONObject(i).getString("Id"), i + "");
		}
		JSONArray jsonArray2 = JSONArray.parseArray(
				"[{\"qid\":\"913929\"},{\"qid\":\"1283248\"},{\"qid\":\"1609386\"},{\"qid\":\"1609408\"},{\"qid\":\"913954\"},{\"qid\":\"1161806\"},{\"qid\":\"1351170\"},{\"qid\":\"1351191\"},{\"qid\":\"1351192\"},{\"qid\":\"1504173\"},{\"qid\":\"1609387\"},{\"qid\":\"1609393\"},{\"qid\":\"1609397\"},{\"qid\":\"1609388\"},{\"qid\":\"1609414\"},{\"qid\":\"1283257\"},{\"qid\":\"1351188\"},{\"qid\":\"1609412\"},{\"qid\":\"1283250\"},{\"qid\":\"1283253\"},{\"qid\":\"1351158\"},{\"qid\":\"1351189\"},{\"qid\":\"1351190\"},{\"qid\":\"1609383\"},{\"qid\":\"1609384\"},{\"qid\":\"1609385\"},{\"qid\":\"1609390\"},{\"qid\":\"1609394\"},{\"qid\":\"1609395\"},{\"qid\":\"1609396\"},{\"qid\":\"1609398\"},{\"qid\":\"1609405\"},{\"qid\":\"1609409\"},{\"qid\":\"1610747\"},{\"qid\":\"1610749\"},{\"qid\":\"1610758\"},{\"qid\":\"1610760\"},{\"qid\":\"1610821\"},{\"qid\":\"1614839\"},{\"qid\":\"1614844\"},{\"qid\":\"1351193\"},{\"qid\":\"1609382\"},{\"qid\":\"1283252\"},{\"qid\":\"1351201\"},{\"qid\":\"1351203\"},{\"qid\":\"1283245\"},{\"qid\":\"1283222\"},{\"qid\":\"1609250\"},{\"qid\":\"1609410\"},{\"qid\":\"1609389\"},{\"qid\":\"1610828\"},{\"qid\":\"1283249\"},{\"qid\":\"1283251\"},{\"qid\":\"1609229\"},{\"qid\":\"1609235\"},{\"qid\":\"1609249\"},{\"qid\":\"1609391\"},{\"qid\":\"1609392\"},{\"qid\":\"1609399\"},{\"qid\":\"1609400\"},{\"qid\":\"1609401\"},{\"qid\":\"1609402\"},{\"qid\":\"1609403\"},{\"qid\":\"1609404\"},{\"qid\":\"1609407\"},{\"qid\":\"1609411\"},{\"qid\":\"1609413\"},{\"qid\":\"1610823\"},{\"qid\":\"1610825\"}]");
		int n1 = 0;
		for (int i = 0; i < jsonArray2.size(); i++) {
			if (map1.containsKey(jsonArray2.getJSONObject(i).getString("qid"))) {
				n1++;
			}
		}
		System.out.println("组1的数量:" + jsonArray1.size());
		System.out.println("组2的数量:" + jsonArray2.size());
		System.out.println("组2在组1中存在的数量:" + n1);
	}

	//全部数据分析报表订单数据清除和采集
	public void copystrTodivision() throws ParseException {
		// TODO 数据清除和采集
		String updateColumn_water[]= {"yeji", "yejiordernumber", "new_yeji", "new_yejiordernumber", "new_yeji_day", "new_yeji_week", "new_yeji_month" 
                , "new_yeji_nodingjin", "new_yejiorder_nodingjin", "new_yeji_day_nodingjin", "new_yeji_week_nodingjin", "new_yeji_month_nodingjin", "new_yeji_month_order", "new_yeji_month_order_nodingjin"
                , "yeji_nodingjin", "yejiordernumber_nodingjin", "pt_new_yeji", "sj_new_yeji", "pt_new_yeji_order", "sj_new_yeji_order", "pt_new_yeji_nodingjin", "sj_new_yeji_nodingjin", "pt_new_yeji_order_nodingjin"
                , "sj_new_yeji_order_nodingjin", "new_yeji_day7", "new_yeji_order_day7", "new_yeji_day7_nodingjin", "new_yeji_order_day7_nodingjin"
                , "new_yeji_day30", "new_yeji_order_day30", "new_yeji_day30_nodingjin", "new_yeji_order_day30_nodingjin","new_yeji_week_order"
                ,"new_yeji_week_order_nodingjin", "sittingwater", "sittingorder", "new_sittingwater", "new_sittingorder", "new_customer_number"
                , "ytk_petty_sittingwater_nodingjin", "other_sittingwater_nodingjin","tj_new_sittingwater_cache", "tj_new_sittingorder_cache", "tj_new_sittingorder_cache_nodingjin", "tj_pt_new_sittingwater_cache"
                , "tj_pt_new_sittingorder_cache", "tj_sj_new_sittingwater_cache", "tj_sj_new_sittingorder_cache", "tj_pt_new_customer_number_cache", "tj_sj_new_customer_number_cache"
                , "new_sittingwater_nodingjin", "new_sittingorder_nodingjin", "normal_sittingwater", "normal_sittingorder", "tj_normal_sittingwater", "tj_normal_sittingorder"
                , "tj_sittingwater", "tj_sittingorder", "tj_new_sittingwater", "tj_new_sittingorder", "bj_normal_sittingwater", "bj_normal_sittingorder", "bj_sittingwater"
                , "bj_sittingorder", "bj_new_sittingwater", "bj_new_sittingorder", "cq_normal_sittingwater", "cq_normal_sittingorder", "cq_sittingwater", "cq_sittingorder"
                , "cq_new_sittingwater", "cq_new_sittingorder", "pt_new_sittingwater", "pt_new_customer_number", "js_new_sittingwater", "sj_new_customer_number", "sittingwater_nodingjin"
                , "sittingorder_nodingjin", "pt_new_sittingwater_order", "sj_new_sittingwater_order", "pt_new_sittingwater_nodingjin", "sj_new_sittingwater_nodingjin", "pt_new_sittingwater_order_nodingjin"
                , "sj_new_sittingwater_order_nodingjin"};
		String updateset="";
		for (int i = 0; i < updateColumn_water.length; i++) {
			updateset+=updateColumn_water[i]+"=0,";
		}
		updateset=updateset.substring(0, updateset.length()-1);
		//ptflagfree=1,flagfree=1
		String updatesql="",updatesql2="",updatesql3="";
		for (int i = 0; i <1; i++) {
			String sql="UPDATE extension_pt_promotion_analysis set "+updateset
					 +" where pt>=20211001 and extensionsourceid<100000 and masterid=0;";
			
			String sql2="UPDATE user_orderinfo set ptflagfree=1,flagfree=1 "
					+ " WHERE realprice>0 and state=1 "
					+ " and ordertype IN ('open','update','buytime','goldmember','changecourse','blackcard','senior')"
					+ " and addtime>='2021-10-01' and register_masterid=0;";
			
			String sql3="UPDATE user_orderinfo set ptflagfree=1,flagfree=1 "
					+ " WHERE realprice>0 and state=1 "
					+ " and ordertype IN ('open','update','buytime','goldmember','changecourse','blackcard','senior')"
					+ " and register_date>=20211001 and register_masterid=0;";
			updatesql+=sql;
			updatesql2+=sql2;
			updatesql3+=sql3;
		}
		System.out.println(updatesql);
		System.out.println(updatesql2);
		System.out.println(updatesql3);

	}
	//推广来源报表订单数据清除和采集
	public void copystrTodivision_campaign() throws ParseException {
		String updatesql="",updatesql2="";
		String updateColumn_water[]= {"all_yeji","all_yejiordernumber","monthly_yeji","monthly_yejiordernumber","monthflag"
				,"all_yejiordernumber_nodingjin","project_team","all_yeji_nodingjin","new_yeji_day7","new_yeji_order_day7"
				,"new_yeji_day7_nodingjin","new_yeji_order_day7_nodingjin","new_yeji_day30","new_yeji_order_day30","new_yeji_day30_nodingjin"
				,"new_yeji_order_day30_nodingjin","pt_new_yeji","sj_new_yeji","pt_new_yeji_order","sj_new_yeji_order"
				,"pt_new_yeji_nodingjin","sj_new_yeji_nodingjin","pt_new_yeji_order_nodingjin","sj_new_yeji_order_nodingjin","all_sittingwater","all_sittingordernumber","monthflag","all_sittingordernumber_nodingjin","project_team"
        		,"all_sittingwater_nodingjin","pt_new_sittingwater","pt_new_sittingwater_order","pt_new_customer_number","js_new_sittingwater","sj_new_sittingwater_order"
        		,"sj_new_customer_number","pt_new_sittingwater_nodingjin","pt_new_sittingwater_order_nodingjin","sj_new_sittingwater_nodingjin","sj_new_sittingwater_order_nodingjin"};
		String updateset="";
		for (int i = 0; i < updateColumn_water.length; i++) {
			updateset+=updateColumn_water[i]+"=0,";
		}
		updateset=updateset.substring(0, updateset.length()-1);
		// flag=3
		for (int i = 0; i <1; i++) {
			String sql="UPDATE promotion_campaign_group_analysis set "+updateset
					 +" where pt>=20211001 and masterid=0;";
			String sql2="UPDATE user_orderinfo set flag=3 "
					+ " WHERE realprice>0"
					+ " and ordertype IN ('open','update','buytime','goldmember','changecourse','blackcard','senior')"
					+ " and state=1 and addtime>='2021-07-01' ";
			updatesql+=sql;
			updatesql2+=sql2;
		}
		System.out.println(updatesql);
//		System.out.println(updatesql2);
	}
	/**
	 * 数据库中复制出来的id列表合成id以逗号分隔的字符串,去除重复的
	 */
	public void getuserid() {
		String str="20130295\r\n"
				+ "20130312\r\n"
				+ "20130341\r\n"
				+ "20130342\r\n"
				+ "20130348\r\n"
				+ "20130353\r\n"
				+ "20130360\r\n"
				+ "20130363\r\n"
				+ "20130398\r\n"
				+ "20130423\r\n"
				+ "20130424\r\n"
				+ "20130430\r\n"
				+ "20130464\r\n"
				+ "20130473\r\n"
				+ "20130573\r\n"
				+ "20130639\r\n"
				+ "20130652\r\n"
				+ "20130666\r\n"
				+ "20130795\r\n"
				+ "20130797\r\n"
				+ "20130801\r\n"
				+ "20130813\r\n"
				+ "20130818\r\n"
				+ "20130819\r\n"
				+ "20130823\r\n"
				+ "20130828\r\n"
				+ "20130842\r\n"
				+ "20130856\r\n"
				+ "20130873\r\n"
				+ "20130890\r\n"
				+ "20130923\r\n"
				+ "20130943\r\n"
				+ "20130948\r\n"
				+ "20130959\r\n"
				+ "20131008\r\n"
				+ "20131213\r\n"
				+ "20131264\r\n"
				+ "20131269\r\n"
				+ "20131289\r\n"
				+ "20131295\r\n"
				+ "20131302\r\n"
				+ "20131342\r\n"
				+ "20131352\r\n"
				+ "20131366\r\n"
				+ "20131392\r\n"
				+ "20131423\r\n"
				+ "20131424\r\n"
				+ "20131440\r\n"
				+ "20131457\r\n"
				+ "20131466\r\n"
				+ "20131540\r\n"
				+ "20131543\r\n"
				+ "20131550\r\n"
				+ "20131603\r\n"
				+ "20131619\r\n"
				+ "20131631\r\n"
				+ "20131657\r\n"
				+ "20131677\r\n"
				+ "20131867\r\n"
				+ "20131893\r\n"
				+ "20131944\r\n"
				+ "20132086\r\n"
				+ "20132120\r\n"
				+ "20132143\r\n"
				+ "20132169\r\n"
				+ "20132217\r\n"
				+ "20132226\r\n"
				+ "20132228\r\n"
				+ "20132354\r\n"
				+ "20132374\r\n"
				+ "20132383\r\n"
				+ "20132421\r\n"
				+ "20132425\r\n"
				+ "20132427\r\n"
				+ "20132461\r\n"
				+ "20132485\r\n"
				+ "20132521\r\n"
				+ "20132529\r\n"
				+ "20132782\r\n"
				+ "20132791\r\n"
				+ "20132798\r\n"
				+ "20132808\r\n"
				+ "20132836\r\n"
				+ "20132839\r\n"
				+ "20132875\r\n"
				+ "20132877\r\n"
				+ "20132879\r\n"
				+ "20132903\r\n"
				+ "20132909\r\n"
				+ "20132929\r\n"
				+ "20132945\r\n"
				+ "20132947\r\n"
				+ "20133015\r\n"
				+ "20133048\r\n"
				+ "20133071\r\n"
				+ "20133119\r\n"
				+ "20133136\r\n"
				+ "20133145\r\n"
				+ "20133156\r\n"
				+ "20133229\r\n"
				+ "20133232\r\n"
				+ "20133240\r\n"
				+ "20133310\r\n"
				+ "20133328\r\n"
				+ "20133468\r\n"
				+ "20133470\r\n"
				+ "20133532\r\n"
				+ "";
		Set<String> set=new HashSet<>();
		String[] split = str.split("\r\n");
		for (int i = 0; i < split.length; i++) {
//			if(set.contains(split[i])) {
//				set.remove(split[i]);
//			}else {
				set.add(split[i]);
//			}
		}
//		for (String s:set) {
//			System.out.print("'"+s+"',");
//		}
		for (String s:set) {
			System.out.print(s+",");
		}
		System.out.println("");
		System.out.println("不重复数量"+set.size());
	}
	/**
	 * 数据库中复制出来的id列表合成数组
	 */
	public void getColumnList() {
			String str="ocid\r\n"
					+ "ordertype\r\n"
					+ "orderid\r\n"
					+ "masterid\r\n"
					+ "coursename\r\n"
					+ "courseid\r\n"
					+ "categoryTitle\r\n"
					+ "orderEndTime\r\n"
					+ "commodityTitle\r\n"
					+ "commodityId\r\n"
					+ "salerid\r\n"
					+ "orderPrice\r\n"
					+ "incomePrice\r\n"
					+ "validity\r\n"
					+ "dayIncomPrice\r\n"
					+ "monthValidDays\r\n"
					+ "monthIncomePrice\r\n"
					+ "gateway\r\n"
					+ "gatewaytitle\r\n"
					+ "state\r\n"
					+ "addtime\r\n"
					+ "userid\r\n"
					+ "validityEndTime\r\n"
					+ "After_orderinfo_addtime\r\n"
					+ "ByTheTime\r\n"
					+ "isupdate";
			Set<String> set=new HashSet<>();
			String[] split = str.split("\r\n");
			for (int i = 0; i < split.length; i++) {
//				if(set.contains(split[i])) {
//					set.remove(split[i]);
//				}else {
				System.out.print("\""+split[i]+"\",");
					set.add(split[i]);
//				}
			}
//			for (String s:set) {
//				System.out.print("'"+s+"',");
//			}
			for (String s:set) {
//				System.out.print(s+",");
//				System.out.print("\""+s+"\",");
			}
			System.out.println("");
			System.out.println("不重复数量"+set.size());
		}

}
